package cn.myframe.redis.pojo;

import org.apache.commons.lang.StringUtils;

import com.alibaba.fastjson.annotation.JSONField;

import lombok.Data;

/**
 * 回复语对象
 * 
 * @author ynz
 * @email ynz@myframe.cn
 * @date 2018年9月27日 上午11:16:37
 */
@Data
public class ReplyRedis {
	
	private Long id;
	
	//成功获到红包的提示语	
	private String successReply;	
	//活动未开始的回复语	
	private String notstartedReply;	
	//活动已经结束的回复语	
	private String endedReply;	
	//用户重复参加回复	
	private String rejoinReply;	
	//发送完的回复语	
	private String sendFinishReply;	
	//发送失败回复语	
	private String sendFailReply;
	
	/**
	 * 成功
	 */
	@JSONField(serialize = false)
	public final static String SUCCESS_REPLY = "000000";
	/**
	 * 发送失败
	 */
	@JSONField(serialize = false)
	public final static String FAIL_REPLY = "-1";
	/**
	 * 红包发送中.....
	 */
	@JSONField(serialize = false)
	public final static String SENDING_REPLY = "100";
	
	
	public ReplyRedis(){}

	public ReplyRedis(Long id, String successReply, String notstartedReply, String endedReply, String rejoinReply,
			String sendFinishReply, String sendFailReply) {
		this.id = id;
		this.successReply = successReply;
		this.notstartedReply = notstartedReply;
		this.endedReply = endedReply;
		this.rejoinReply = rejoinReply;
		this.sendFinishReply = sendFinishReply;
		this.sendFailReply = sendFailReply;
	}
	
	public String returnReply(String code){
		String returnStr = "";
		if(StringUtils.isNotEmpty(code)){
			switch (code) {
			case SUCCESS_REPLY:
				returnStr = this.successReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="红包发送成功,请及时领取!";
				}
				break;
			case SENDING_REPLY:
				returnStr ="红包正在发放中..."; 
				break;
			case "100020":
				returnStr = this.notstartedReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="活动尚未开始,请留意活动开始时间!";
				}
				break;
			case "100021":
				returnStr = this.endedReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="活动已经结束,谢谢您的参与!";
				}
				break;
			case "100005":
				returnStr = this.rejoinReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="您已经参与过活动,不能再参与!";
				}
				break;
			case "100004":
				returnStr = this.sendFinishReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="活动名额已经派完,欢迎下次参与!";
				}
				break;
			default:
				returnStr = this.sendFailReply;
				if(StringUtils.isEmpty(returnStr)){
					returnStr ="您并未获取到活动红包!";
				}
				break;
			}
		}
		return returnStr;
	}
	
	

}
